﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Pacocation
{
    class Obstaculo
    {       
            Texture2D texturaObstaculo;
            public List<Rectangle> listRects;
            public int numeroObstaculosX, numeroObstaculosY, separarObstaculosX, separarObstaculosY;
            public bool PodeDescer = false;
            

        public Obstaculo(ContentManager Content)
        {
            texturaObstaculo = Content.Load<Texture2D>("brick");

            numeroObstaculosX = 8;
            numeroObstaculosY = 5;
            separarObstaculosX = 240;
            separarObstaculosY = 10;
            listRects = new List<Rectangle>();
        }

        public void Update(GameTime gametime)
        {
            
        }

        public void DesenhaObstaculos()
        {
            for (int i = 0; i < numeroObstaculosY; i++)
            {
                for (int t = 0; t < numeroObstaculosX; t++)
                {
                    listRects.Add(new Rectangle(separarObstaculosX, separarObstaculosY, texturaObstaculo.Width, texturaObstaculo.Height));

                    separarObstaculosX += (texturaObstaculo.Width + 5);
                }

                separarObstaculosY += (texturaObstaculo.Height + 5);
                separarObstaculosX = 240;
            }
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();

                for(int i = 0; i < listRects.Count; i ++)
                {
                    spriteBatch.Draw(texturaObstaculo, listRects[i], Color.White);
                }

            spriteBatch.End();
        }
    }
}
